<template>
	<view class="pageBox">
		<view class="list">
			<view class="listItem" v-for="item in list" :key="item.id">
				<view class="listItemTop flex-between">
					<view class="left">
						<view class="leftTop">
							时间
						</view>
						<view class="leftBom">
							{{ item.createdAt }}
						</view>
					</view>
					<view class="right">
						<view class="rightTop">
							状态
						</view>
						<view class="rightBom colorBlack">
							申请提现
						</view>
					</view>
					<view class="right" v-if="item.status == 0">
						<view class="rightTop">
							状态
						</view>
						<view class="rightBom colorRed">
							审核中
						</view>
					</view>
					<view class="right" v-if="item.status == 0">
						<view class="rightTop">
							详情
						</view>
						<view class="rightBom colorBlack">
							{{ item.money }}元
						</view>
					</view>
					
					<view class="right" v-if="item.status == -1">
						<view class="rightTop">
							状态
						</view>
						<view class="rightBom colorGrey">
							审核失败
						</view>
					</view>
					<view class="right" v-if="item.status == -1">
						<view class="rightTop">
							详情
						</view>
						<view class="rightBom colorGrey">
							{{ item.money }}元
						</view>
					</view>
					
					
					<view class="right" v-if="item.status == 1">
						<view class="rightTop">
							状态
						</view>
						<view class="rightBom colorRed">
							审核通过
						</view>
					</view>
					<view class="right" v-if="item.status == 1">
						<view class="rightTop">
							详情
						</view>
						<view class="rightBom colorRed">
							{{ item.money }}元
						</view>
					</view>
				</view>
				<view class="listItemBom"  v-if="item.status == -1">
					拒绝原因：{{ item.reason }}
				</view>
			</view>
		</view>
		<uni-load-more :status="listStatus"></uni-load-more>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				form: {
					page: 1,
					lastId: 0,
				},
				loading: false,
				finished: false,
			}
		},
		onShow() {
			this.list = [];
			this.form.page = 1;
			this.form.lastId = 0;
			this.loading = false;
			this.finished = false;
			this.getList();
		},
		onReachBottom() {
			this.getList();
		},
		computed: {
			listStatus() {
				if (this.finished) return "noMore";
				if (this.loading) return "loading";
				return "more";
			}
		},
		methods: {
			getList() {
				if (this.loading || this.finished) return;
				this.loading = true;
				this.$post({
					module: 'Finance',
					interface: '4002',
					data: this.form,
				}).then(res => {
					this.list = this.list.concat(res.list);
					this.form.page = res.currentPage + 1;
					this.form.lastId = res.lastId;
					if (this.form.page > res.lastPage) {
						this.finished = true;
					}
					this.loading = false;
				}).catch(() => {
					this.loading = false;
				})
			},
		},
	}
</script>

<style scoped lang="scss">
	.pageBox {
		padding: 0 32rpx;

		.list {
			.listItem {
				background: #FFFFFF;
				box-shadow: 0px 4rpx 8rpx 0px rgba(212,212,212,0.3);
				border-radius: 24rpx 24rpx 24rpx 24rpx;
				padding: 26rpx 14rpx;
				margin-bottom: 16rpx;
				.listItemTop {
					.left {
						.leftTop {
							font-size: 24rpx;
							font-family: PingFang SC-Medium, PingFang SC;
							font-weight: 500;
							color: #000000;
						}
						.leftBom {
							font-size: 24rpx;
							font-family: PingFang SC-Medium, PingFang SC;
							font-weight: normal;
							color: #202236;
							margin-top: 32rpx;
						}
					}
					.right {
						.rightTop {
							font-size: 24rpx;
							font-family: PingFang SC-Medium, PingFang SC;
							font-weight: 500;
							color: #000000;
						}
						.rightBom {
							font-size: 24rpx;
							font-family: PingFang SC-Medium, PingFang SC;
							font-weight: normal;
							margin-top: 32rpx;
						}
						.colorBlack {
							color: #202236;
						}
						.colorRed {
							color: #FF0000;
						}
						.colorGrey {
							color: #999999;
						}
					}
				}
				.listItemBom {
					margin-top: 32rpx;
					font-size: 24rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #999999;
				}
			}
			// .listItem {
			// 	border-bottom: 2rpx solid #EBEDF0;
			// 	padding: 64rpx 0;

			// 	.top {
			// 		.topL {
			// 			font-size: 28rpx;
			// 			font-family: PingFangSC-Regular, PingFang SC;
			// 			font-weight: 400;
			// 			color: #000000;
			// 			line-height: 40rpx;
			// 		}

			// 		.topR {
			// 			font-size: 28rpx;
			// 			font-family: PingFangSC-Regular, PingFang SC;
			// 			font-weight: 400;
			// 			color: #afa9b0;
			// 			line-height: 40rpx;
			// 		}
			// 	}

			// 	.center {
			// 		margin-top: 32rpx;

			// 		.centerL {
			// 			font-size: 28rpx;
			// 			font-family: PingFangSC-Regular, PingFang SC;
			// 			font-weight: 400;
			// 			color: #000000;
			// 			line-height: 40rpx;
			// 		}

			// 		.centerR {
			// 			font-size: 36rpx;
			// 			font-family: DINAlternate-Bold, DINAlternate;
			// 			font-weight: bold;

			// 			line-height: 40rpx;
			// 		}

			// 		.centerGrey {
			// 			color: #afa9b0;
			// 		}

			// 		.centerBlack {
			// 			color: #000000;
			// 		}

			// 		.centerRed {
			// 			color: #FE2E1C;
			// 		}
			// 	}

			// 	.bom {
			// 		font-size: 28rpx;
			// 		font-family: PingFangSC-Regular, PingFang SC;
			// 		font-weight: 400;
			// 		color: #afa9b0;
			// 		line-height: 40rpx;
			// 		margin-top: 32rpx;
			// 	}
			// }
		}
	}
</style>
